{include file="public:header"/}

{include file="public:sidemenu"/}
		<!-- Start right Content here -->
		<div class="content-page">
			<!-- Start content -->
			<div class="content">
				<div class="am-g">


          <button><a href="{:url('jiekou')}">查看</a></button>
					<span>
						<button type="button" class="btn btn-default" data-toggle="modal" data-target="#addmodal" style="float: right;margin-right: 100px;color: #1E90FF">
						<i class="fa fa-plus fa-2x" aria-hidden="true" >添加</i>
						</button></span> 
					
						
        <div class="am-u-sm-12">
              <table id="clubs" class="am-table am-table-striped am-table-hover table-main">
                <thead>
                  <tr>
                  	<th>编号</th>
                    <th>管理员名</th>
                    <th>性别</th>
                    <th>联系电话</th>
                    <th>管理俱乐部名</th>
                    <th>操作</th>
                  </tr>
                </thead>
                <tbody>
                {volist name="clubadmins" id="vo"}
                  <tr>
                  	<td>{$vo.ca_id}</td>
                    <td>{$vo.ca_name}</td>
                    <td>
                      {if condition="$vo.ca_gender==1"}<span>男</span>
                      {else /}<span>女</span>
                      {/if}
                    </td>
                    <td>{$vo.ca_tel}</td>
                    <td>{$vo.c_name}</td>
                    <td>
                      <div class="am-btn-toolbar">
                        <div class="am-btn-group am-btn-group-xs">
                          <a href="#" data-toggle="modal" data-target="#editmodal" onclick="jsedit({$vo.ca_id})">修改</a>
                          |
                          <a href="{:url('delete',['id'=>$vo.ca_id])}">删除</a>
                        </div>
                      </div>

                    </td>
                  </tr>
                  {/volist}
                </tbody>
              </table>
            </div> 


<!-- 添加模态框 -->
    <div id="addmodal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
      <div class="modal-header">
        <h3 id="myModalLabel">添加俱乐部管理员</h3>
      </div>
      <div class="modal-body">
        <p>
        <form class="am-form am-text-sm" method="post" action="{:url('add')}" enctype="multipart/form-data">

  <div class="form-group">
    <label  class="col-sm-2 am-form-label" for="ca_name" >管理员名称</label>
    <div class="col-sm-10">
      <input type="text" class="form-control" id="ca_name" placeholder="管理员名称" name="ca_name" required>
    </div>
  </div>

  <div class="form-group">
    <label for="password" class="col-md-2 col-xs-2 control-label">密码</label>
    <div class="col-md-10 col-xs-10">
      <input type="password" class="form-control" id="ca_password" placeholder="密码" name="ca_password" required>
    </div>
  </div>

 <div class="form-group">
    <label  class="col-md-2 col-xs-2 control-label">性别</label>
    <div class="col-md-10 col-xs-10">
        <input type="radio" id="ca_gender" name="ca_gender" value="0" >女
        <input type="radio" id="ca_gender" name="ca_gender" value="1">男
      </div>
  </div>

  <div class="form-group">
    <label  class="col-sm-2 am-form-label" for="ca_tel" >联系电话</label>
    <div class="col-sm-10">
      <input type="text" class="form-control" id="ca_tel" placeholder="联系电话" name="ca_tel" required>
    </div>
  </div>

  <div class="form-group">
    <label  class="col-sm-2 am-form-label">管理俱乐部id</label>
    <div class="col-sm-10">
    <select class="form-control" name="c_name">
    {volist name="clubs" id="tp"}
  <option value={$tp.c_id}>{$tp.c_name} </option>
{/volist}
    
</select> 
    </div>
  </div>


  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <input type="submit" class="btn btn-default" value="添加">
     <input type="reset" class="btn btn-default" value="重置">
  </div>
  </div>
</form>       


        </p>
      </div>
      <div class="modal-footer">
        <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
        <button class="btn btn-primary">Save changes</button>
      </div>
    </div>  
</div>
</div>


<!-- 修改模态框 -->
     <div id="editmodal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
      <div class="modal-header">
        <h3 id="myModalLabel">修改俱乐部</h3>
      </div>
      <div class="modal-body">
        <p>
        <form class="am-form am-text-sm" method="post" action="{:url('update')}" enctype="multipart/form-data">
          <input type="hidden" name="ca_id" id="caid_edit">

  <div class="form-group">
    <label  class="col-sm-2 am-form-label" for="ca_name" >管理员名称</label>
    <div class="col-sm-10">
      <input type="text" class="form-control" id="ca_namea" placeholder="管理员名称" name="ca_name" required>
    </div>
  </div>

  <div class="form-group">
    <label for="password" class="col-md-2 col-xs-2 control-label">密码</label>
    <div class="col-md-10 col-xs-10">
      <input type="password" class="form-control" id="ca_passworda" placeholder="密码" name="ca_password" >
    </div>
  </div>

 <div class="form-group">
    <label  class="col-md-2 col-xs-2 control-label">性别</label>
    <div class="col-md-10 col-xs-10">
        <input type="radio" id="ca_gendera" name="ca_gender" value="0" >女
        <input type="radio" id="ca_gendera" name="ca_gender" value="1">男
      </div>
  </div>

  <div class="form-group">
    <label  class="col-sm-2 am-form-label" for="ca_tel" >联系电话</label>
    <div class="col-sm-10">
      <input type="text" class="form-control" id="ca_tela" placeholder="联系电话" name="ca_tel" required>
    </div>
  </div>

  <div class="form-group">
    <label>俱乐部名</label>
    <div >
    <select class="form-control" name="c_name" id="c_namea">
    {volist name="clubs" id="tp"}
  <option value={$tp.c_id}>{$tp.c_name} </option>
{/volist}
    
</select> 
    </div>
  </div>

  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <input type="submit" class="btn btn-default" value="修改">
     <input type="reset" class="btn btn-default" value="重置">
  </div>
  </div>
</form>       


        </p>
      </div>
      <div class="modal-footer">
        <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
        <button class="btn btn-primary">Save changes</button>
      </div>
    </div>  
</div>
</div>



</div><!-- 3 -->
</div><!-- 2 -->
		</div><!-- 1 -->

<script>
      function jsedit(ca_id) {
              //根据TID到数据库里把数据查询到显示在表单控件中
              $.getJSON("{:url('edit')}",{"ca_id":ca_id},
                  function(json) {
                      //alert(json.intro);
                      $("#caid_edit").val(json.ca_id);
                      $("#ca_ida").val(json.ca_id);
                      $("#ca_namea").val(json.ca_name);
                      $("#ca_tela").val(json.ca_tel);
                      /*$("#ca_gendera").val(json.ca_gender);*/
                      $("#ca_genderb option[value="+json.ca_id+"]").attr("selected","selected");
                      $("#c_namea option[value="+json.c_id+"]").attr("selected","selected");
                  });
          }
    </script>	

{include file="public:footer"/}